<template>
    <van-swipe :autoplay="3000" lazy-render @change="onChange">
        <van-swipe-item v-for="image in list" :key="image">
            <img :src="image" />
        </van-swipe-item>
    </van-swipe>
</template>

<script setup>
const props = defineProps({
    modelValue: {
        type: Number,
        required: true,
        default: 0
    },
    list: {
        type: Array,
        default: () => []
    },
})

const emit = defineEmits(['update:modelValue'])
function onChange(index) {
    emit('update:modelValue', index)
}

</script>

<style lang="less" scoped>
img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
</style>